﻿@using Radzen
@using Microsoft.JSInterop
@using Microsoft.AspNetCore.Components.Forms
@typeparam TValue
@inherits FormComponent<TValue>

@if (Visible)
{
    <span @ref="@Element" style="@Style" @attributes="Attributes" class="@GetCssClass()" id="@GetId()">
        <input @ref="@input" @attributes="InputAttributes" type="text" inputmode="decimal" name="@Name" disabled="@Disabled" readonly="@ReadOnly"
               class="@GetInputCssClass()" tabindex="@(Disabled ? "-1" : $"{TabIndex}")"
               placeholder="@CurrentPlaceholder" autocomplete="@AutoCompleteAttribute" value="@FormattedValue" @onchange="@OnChange"
               onkeypress="Radzen.numericKeyPress(event, @IsInteger().ToString().ToLower())"
           onblur="@getOnInput()" onpaste="@getOnPaste()" />
        @if (ShowUpDown)
        {
            <button type="button" class="rz-spinner-button rz-spinner-up rz-button" tabindex="-1"
                    @onclick="@((args) => UpdateValueWithStep(true))">
                <span class="rz-spinner-button-icon rzi rzi-caret-up"></span>
            </button>
            <button type="button" class="rz-spinner-button rz-spinner-down rz-button" tabindex="-1"
                    @onclick="@((args) => UpdateValueWithStep(false))">
                <span class="rz-spinner-button-icon rzi rzi-caret-down"></span>
            </button>
        }
    </span>
}
